import React from 'react';
import * as PropTypes from 'prop-types'

import {Util} from '..';
import {MapContext} from '../Context';
import * as layerFactory from 'ol/layer';
import OSM from "ol/source/OSM";

class Image extends React.Component {
  static defaultProps = {

  };
  constructor(props) {
    super(props);
    this.state = {

    };
    this.options = {
      className: undefined,
      opacity: undefined,
      visible: undefined,
      extent: undefined,
      zIndex: undefined,
      minResolution: undefined,
      maxResolution: undefined,
      minZoom: undefined,
      maxZoom: undefined,
      map: undefined,
      source: undefined,
    }
    this.layer = new layerFactory.Image()
  }

  componentDidMount() {
    this.init();
  }
  init = () => {
    Util.updateOptions(this.options,this.props)
    this.layer = new layerFactory.Image(this.options);
    this.context.mapComp.layers.push(this.layer)
  };

  render() {
    return null;
  }
}
Image.propTypes = {

}
Image.contextType = MapContext;
export default Image;

